package com.ctshk.app.tour.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.tour.req.es.TripCacheUpdateReq;
import com.ctshk.rpc.tour.service.ISeriesTripAppService;
import com.ctshk.rpc.tour.service.ISeriesTripScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 系列团行程 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-12
 */
@Api(value = "旅行团-APP-缓存管理", tags = "旅行团-APP-缓存管理")
@RestController
@RequestMapping("/series/trip/cache")
public class SeriesTripCacheController extends BaseController {

    @DubboReference
    private ISeriesTripAppService iSeriesTripAppService;

    @DubboReference
    private ISeriesTripScheduleService iSeriesTripScheduleService;

    @ApiOperation(value = "旅行团-缓存-初始化", notes = "旅行团-缓存-初始化")
    @OperationLogAnnotation(operModul = OperationLogModel.TOUR, operType = OperationLogType.QUERY, operTitle = "旅行团-缓存-初始化", operDesc = "旅行团-缓存-初始化")
    @GetMapping("/init")
    public Result tripInit() {
        return iSeriesTripAppService.tripInit();
    }

    @ApiOperation(value = "旅行团-缓存更新", notes = "旅行团-更新")
    @OperationLogAnnotation(operModul = OperationLogModel.TOUR, operType = OperationLogType.UPDATE, operTitle = "旅行团-更新", operDesc = "旅行团-更新")
    @PostMapping("/updata")
    public Result updateTrip(@RequestBody TripCacheUpdateReq req) {
        return iSeriesTripAppService.updateTripCache(req);
    }

}
